<? import_request_variables("gP"); ?>
<? 
@session_start();
include "conexao.php";
connect();
// inclui a pagina com as funcoes da paginacao
include_once('pagination.php');
?>
<HTML>
<HEAD>
<TITLE>PROTOCOLO - Setor de Protocolo</TITLE>
</HEAD>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link href='auxiliar/styles.css' rel='stylesheet' type='text/css'>
<script language="JavaScript" src="auxiliar/date-picker.js"></script>
<body>
<table align="center" border="1" width="77%" cellpadding="0" cellspacing="0">
<?
	$sqlquery1="select nprocesso from processo where idprocesso = '".$idprocesso."'";
	mysql_query("SET NAMES 'utf8'");
	mysql_query('SET character_set_connection=utf8');
	mysql_query('SET character_set_client=utf8');
	mysql_query('SET character_set_results=utf8');
	
	$process = mysql_query($sqlquery1) or die("Erro: " . mysql_error());	
	while ($line = mysql_fetch_array($process)){
		$nprocesso = $line['nprocesso'];
	}
?>	

<?
	$sqlquery="select * from volume where id_processo = '".$idprocesso."'";
	mysql_query("SET NAMES 'utf8'");
	mysql_query('SET character_set_connection=utf8');
	mysql_query('SET character_set_client=utf8');
	mysql_query('SET character_set_results=utf8');
	
	$process = mysql_query($sqlquery) or die("Erro: " . mysql_error());	
	$num = mysql_num_rows($process);
        if($num != 0 ){
?><h3>Processo : <? echo ($nprocesso);?></h3>
		<tr>
			<td style="background:#6699CC; border-bottom:#333333 1px solid;">Volume</td>
			<td style="background:#6699CC; border-bottom:#333333 1px solid;">Folhas</td>
			<td style="background:#6699CC; border-bottom:#333333 1px solid;">Data Criação</td>
		</tr>
		<?
	while ($line = mysql_fetch_array($process)){
		$volume = $line['volume'];
?>	
		
		<tr>
			<td style="border-bottom:#999999 1px solid;"><a href="mostra_processo_volume.php?idprocesso=<? echo ($idprocesso); ?>&idvolume=<? echo ($volume); ?>"><? echo ($volume); ?></a></td>
			<td style="border-bottom:#999999 1px solid;"><a href="mostra_processo_volume.php?idprocesso=<? echo ($idprocesso); ?>&idvolume=<? echo ($volume); ?>"><? echo ($line['folhas']); ?></a></td>
			<td style="border-bottom:#999999 1px solid;"><a href="mostra_processo_volume.php?idprocesso=<? echo ($idprocesso); ?>&idvolume=<? echo ($volume); ?>"><? echo ($line['data_criacao']); ?></a></td>
		</tr>

<?}?>

<?}else{ ?>
<h3>Cadastrar volume do processo : <? echo ($nprocesso); ?></h3>
<form name="form1" id="form1" method="post" action="volumeinsert.php">
<table width ="38%" align='center' border="1" cellpadding="1" cellspacing="2">
       
  
            <input type="hidden" name="txtidprocesso" maxlength="15" value="<? echo $idprocesso; ?>">&nbsp;
            <tr> <td class="caixaazul"><div align='right'>Volume a ser cadastrado:
                <input type="text" name="txtvolume" maxlength="15" value="<? echo $txtvolume; ?>">&nbsp;</div>
             
                </td> </tr>       
            <tr><td class="caixaazul"><div align='right'>Número de Folhas:
                <input type="text" name="txtfolha" maxlength="15" value="<? echo $txtfolha; ?>">&nbsp;</div>
                
            </td>
            </tr>
                
            <tr> <td class="caixaazul"><div align='right'>Data Cadastro:
                <input type="text" name="txtdata" maxlength="15" value="<? echo $txtdata; ?>">&nbsp;</div>
             
                </td></tr>
            <tr><td class="caixaazul"><div align='left'>
                 <input name='gravar' align='left' type='submit' value='gravar' class='botao'>
                </div</td></tr>
           
		

    
</table>
</form>
 
<?}?>
</table>
<? if($num != 0 && $_SESSION["id_setor"] == 28 ){?>
 <br />
<h3>Cadastre novos volumes para o processo : <? echo ($nprocesso); ?></h3>
<form name="form1" id="form1" method="post" action="volumeinsert.php">
<table width ="38%" align='center' border="1" cellpadding="1" cellspacing="2">
       
  
            <input type="hidden" name="txtidprocesso" maxlength="15" value="<? echo $idprocesso; ?>">&nbsp;
            <tr> <td class="caixaazul"><div align='right'>Volume a ser Cadastrado:
                <input type="text" name="txtvolume" maxlength="15" value="<? echo $txtvolume; ?>">&nbsp;</div>
             
                </td> </tr>       
            <tr><td class="caixaazul"><div align='right'>Número de Folhas:
                <input type="text" name="txtfolha" maxlength="15" value="<? echo $txtfolha; ?>">&nbsp;</div>
                
            </td>
            </tr>
                
            <tr> <td class="caixaazul"><div align='right'>Data Cadastro:
                <input type="text" name="txtdata" maxlength="15" value="<? echo $txtdata; ?>">&nbsp;</div>
             
                </td></tr>
            <tr><td class="caixaazul"><div align='left'>
                 <input name='gravar' align='left' type='submit' value='gravar' class='botao'>
                </div</td></tr>
           
		

    
</table>
</form>
<?}?>
</body>

</HTML>
